import 'package:flutter/material.dart';
import 'package:expandable/expandable.dart';
import 'package:x3_base_package/x3_base_package.dart';

/// 作者：william on 2021/3/11 14:54
/// 邮箱：362661044@qq.com
class BusinessDetailedMainOrder extends StatefulWidget {
  final BaseRequestFormProvider baseRequestFormProvider;
  final String billsId;
  final RequestSaveData onChanged;
  const BusinessDetailedMainOrder({Key key, @required this.baseRequestFormProvider, @required this.billsId, this.onChanged}) : super(key: key);
  @override
  _BusinessDetailedMainOrderState createState() => _BusinessDetailedMainOrderState();
}

class _BusinessDetailedMainOrderState extends State<BusinessDetailedMainOrder> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      padding: EdgeInsets.symmetric(horizontal: 16),
      child: Material(
        color: Colors.white,
        child: ExpandablePanel(
          theme: ExpandComponentsTheme.expandableThemeData,
          header: _buildBillsId(),
          expanded: BaseRequestForm(
            baseRequestFormProvider: widget.baseRequestFormProvider,
            requestSaveData: widget.onChanged,
          ),
        ),
      ),
    );
  }

  Widget _buildBillsId() {
    return Container(
      alignment: Alignment.centerLeft,
      height: 48,
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.baseline,
        textBaseline: TextBaseline.alphabetic,
        children: [
          BaseFormLabel(text: '单据编号'),
          SizedBox(width: 20),
          Text(widget.billsId ?? '', style: Theme.of(context).textTheme.subtitle2),
        ],
      ),
    );
  }
}
